﻿using personalplaner.common;
using personalplaner.common.mvvm.factory;
using personalplaner.servicemodel.dataaccess;

namespace personalplaner.gui.plugins.dienstplan.viewmodels.factories
{
    public class DienstPlanModelFactory : IFactory
	{
		#region IFactory Members

		public object CreateViewModel(System.Windows.DependencyObject sender)
		{
			var vm = new DienstPlanViewModel(sender);

			vm.ServiceLocator.RegisterService<IDiensteDataAccess>(new DiensteDataAccess(SettingsProvider.Settings));
			vm.ServiceLocator.RegisterService<IPlanDataAccess>(new PlanDataAccess(SettingsProvider.Settings));
            vm.ServiceLocator.RegisterService<IOptionsDataAccess>(new OptionsDataAccess(SettingsProvider.Settings));
			vm.ServiceLocator.RegisterService<IPersonDataAccess>(new PersonDataAccess(SettingsProvider.Settings));
            vm.ServiceLocator.RegisterService<IPlanSchemaDataAccess>(new PlanSchemaDataAccess(SettingsProvider.Settings));
            
			return vm;
		}

		#endregion
	}
}
